

#ifndef CAMERA_H
#define CAMERA_H

#include "Vec4.h"


class Camera {
	
protected:
	
	// SINGLETON
	Camera();	
	
private:
	
	static Camera* _instance;
	
public:	
	
	static Camera* Instance();
	
	friend class EventManager;
	
	Vec4 GetViewDirection();
	const Vec4& GetViewPoint();
	Vec4 GetLocalX();
	Vec4 GetLocalY();
	void RotateViewAboutVertical(float dAngle);
	void RotateViewAboutHorizontal(float dAzimuth);
	void setView(const Vec4& v);
	
	// camera movement
	void Move();
	void goForward();
	void goBackward();
	void goLeft();
	void goRight();
		
	void SetObserverProjection();
	void InitObserver();

private:
				
	float m_fovy;
	float m_near;
	float m_far;
	float m_aspect;
	float m_avoidCosine;
	
	Vec4 m_viewPoint;
	Vec4 m_viewTarget;
	
	Vec4 m_localX;
	Vec4 m_localY;
	

	// view direction on sphere
	float m_azimuth;
	float m_phi;
	
	float m_stepLength;

};

#endif //CAMERA_H
